Optimal. Leaf size=88 \[ \frac {2 b^2 n^2 x}{1+4 b^2 n^2}+\frac {x \cos ^2\left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2}+\frac {2 b n x \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 2, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4566, 8}
\begin {gather*} \frac {x \cos ^2\left (a+b \log \left (c x^n\right )\right )}{4 b^2 n^2+1}+\frac {2 b n x \sin \left (a+b \log \left (c x^n\right )\right ) \cos \left (a+b \log \left (c x^n\right )\right )}{4 b^2 n^2+1}+\frac {2 b^2 n^2 x}{4 b^2 n^2+1} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 4566
Rubi steps
\begin {align*} \int \cos ^2\left (a+b \log \left (c x^n\right )\right ) \, dx &=\frac {x \cos ^2\left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2}+\frac {2 b n x \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2}+\frac {\left (2 b^2 n^2\right ) \int 1 \, dx}{1+4 b^2 n^2}\\ &=\frac {2 b^2 n^2 x}{1+4 b^2 n^2}+\frac {x \cos ^2\left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2}+\frac {2 b n x \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{1+4 b^2 n^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 54, normalized size = 0.61 \begin {gather*} \frac {x \left (1+4 b^2 n^2+\cos \left (2 \left (a+b \log \left (c x^n\right )\right )\right )+2 b n \sin \left (2 \left (a+b \log \left (c x^n\right )\right )\right )\right )}{2+8 b^2 n^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.04, size = 0, normalized size = 0.00 \[\int \cos ^{2}\left (a +b \ln \left (c \,x^{n}\right )\right )\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 280 vs.
\(2 (88) = 176\).
time = 0.32, size = 280, normalized size = 3.18 \begin {gather*} \frac {{\left (2 \, {\left (b \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (4 \, b \log \left (c\right )\right ) - b \cos \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + b \sin \left (2 \, b \log \left (c\right )\right )\right )} n + \cos \left (4 \, b \log \left (c\right )\right ) \cos \left (2 \, b \log \left (c\right )\right ) + \sin \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + \cos \left (2 \, b \log \left (c\right )\right )\right )} x \cos \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) + {\left (2 \, {\left (b \cos \left (4 \, b \log \left (c\right )\right ) \cos \left (2 \, b \log \left (c\right )\right ) + b \sin \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + b \cos \left (2 \, b \log \left (c\right )\right )\right )} n - \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (4 \, b \log \left (c\right )\right ) + \cos \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) - \sin \left (2 \, b \log \left (c\right )\right )\right )} x \sin \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) + 2 \, {\left (4 \, {\left (b^{2} \cos \left (2 \, b \log \left (c\right )\right )^{2} + b^{2} \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} n^{2} + \cos \left (2 \, b \log \left (c\right )\right )^{2} + \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} x}{4 \, {\left (4 \, {\left (b^{2} \cos \left (2 \, b \log \left (c\right )\right )^{2} + b^{2} \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} n^{2} + \cos \left (2 \, b \log \left (c\right )\right )^{2} + \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.07, size = 68, normalized size = 0.77 \begin {gather*} \frac {2 \, b^{2} n^{2} x + 2 \, b n x \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) \sin \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) + x \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2}}{4 \, b^{2} n^{2} + 1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \begin {cases} \int \cos ^{2}{\left (a - \frac {i \log {\left (c x^{n} \right )}}{2 n} \right )}\, dx & \text {for}\: b = - \frac {i}{2 n} \\\int \cos ^{2}{\left (a + \frac {i \log {\left (c x^{n} \right )}}{2 n} \right )}\, dx & \text {for}\: b = \frac {i}{2 n} \\\frac {2 b^{2} n^{2} x \sin ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 1} + \frac {2 b^{2} n^{2} x \cos ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 1} + \frac {2 b n x \sin {\left (a + b \log {\left (c x^{n} \right )} \right )} \cos {\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 1} + \frac {x \cos ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 1} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 786 vs.
\(2 (88) = 176\).
time = 0.53, size = 786, normalized size = 8.93 \begin {gather*} \frac {1}{2} \, x - \frac {4 \, b n x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right ) + 4 \, b n x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right ) + 4 \, b n x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right )^{2} + 4 \, b n x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right )^{2} - x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} - x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} - 4 \, b n x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) - 4 \, b n x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) - 4 \, b n x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (a\right ) - 4 \, b n x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (a\right ) + x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 4 \, x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right ) + 4 \, x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right ) + x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (a\right )^{2} + x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (a\right )^{2} - x e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} - x e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )}}{4 \, {\left (4 \, b^{2} n^{2} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} + 4 \, b^{2} n^{2} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 4 \, b^{2} n^{2} \tan \left (a\right )^{2} + 4 \, b^{2} n^{2} + \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} + \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + \tan \left (a\right )^{2} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.53, size = 56, normalized size = 0.64 \begin {gather*} \frac {x\,\left (2\,{\cos \left (a+b\,\ln \left (c\,x^n\right )\right )}^2+4\,b^2\,n^2+2\,b\,n\,\sin \left (2\,a+2\,b\,\ln \left (c\,x^n\right )\right )\right )}{8\,b^2\,n^2+2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________